﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Activities;

namespace Umbrella.Whs.Service.Activities.SharePoint
{

    public sealed class DeleteDirectory : SafeCodeActivity
    {
        [RequiredArgument]
        public InArgument<string> DirectoryPath { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void ExecuteSafe(CodeActivityContext context)
        {
            var dp = context.GetValue(this.DirectoryPath);
            var di = new DirectoryInfo(dp);

            if (di.Exists)
                di.Delete(true);
        }
    }
}
